﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LiteQuery.Common
{
    class WinForm
    {
        static PopupControl.Popup pop;

        public static void ShowToast(Control parent, string message)
        {
            pop = new PopupControl.Popup(new Controls.FormToast(message))
            {
                ShowingAnimation = PopupControl.PopupAnimations.Slide | PopupControl.PopupAnimations.TopToBottom,
                HidingAnimation = PopupControl.PopupAnimations.Slide | PopupControl.PopupAnimations.BottomToTop
            };
            pop.Show(parent, new Point(parent.Width / 2 - pop.Width / 2, parent.Height / 2 - pop.Height / 2));
        }

        public static void HidToast()
        {
            if(pop!=null)
                pop.Hide();
        }

        public static void ShowInfo(string msg)
        {
            MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static void ShowEror(string msg)
        {
            MessageBox.Show(msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
